package com.cgt.xiaotao.promotion.client;

import com.cgt.xiaotao.promotion.client.domain.dto.ProductRequestDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.math.BigDecimal;

@FeignClient(value = "service-promotion")
@Repository
public interface PromotionFeignClient {

    /**
     * 获取最大优惠金额
     * @param request 请求参数
     * @return 最大优惠金额
     */
    @PostMapping("/user-coupons/maxDiscount")
    BigDecimal getMaxDiscountAmount(@RequestBody ProductRequestDTO request);

    /**
     * 删除优惠券
     * @param couponId 优惠券ID
     * @return 是否成功
     */
    @DeleteMapping("/user-coupons/{couponId}/use")
    Boolean deleteUserCoupon(@PathVariable String couponId);
}
